<?php
/**
 * fldcms
 * ============================================================================
 * 版权所有 2017 福建华晟网络科技，并保留所有权利。
 * 网站地址: http://www.fldcms.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * Author: fld
 * Date: 2017-07-01
 */
namespace app\admin\controller;
use think\Controller;
use think\Db;
use think\Loader;
class TestController extends Controller{
    
	public function addOp(){
		$model = model("Base");
		$data = array();
		for($i = 0;$i < 10;$i++){
			$arrays['admin_name'] = 'admin001'.$i;
			$arrays['admin_password'] = encrypt('123456');
			$arrays['admin_is_super'] = '1';
			$data[] = $arrays;
		}
		echo $model->add_more_table("admin",$data);
	}

	public function getOneOp(){
		$model = model("Base");
		$res = $model->find_table('admin','admin_id = 18');
		dump($res);
	}

	public function getColumnOp(){
		$model = model("Base");
		echo $model->find_column('admin','admin_id = 19','admin_name');
	}

	public function selectOp(){
		$model = model("Base");
		$result = $model->select_table('admin','admin_id > 20');
		print_r($result);
	}

	public function select_pageOp(){
		$model = model("Base");
		$list = $model->select_table_by_page('admin','','','admin_id asc');
		$this->assign('list',$list);
		return $this->fetch();
	}

	public function updateOp(){
		$model = model("Base");
		echo $model->update_table('admin','admin_id = 19',array('admin_password'=>'科技12'));
	}

	public function deleteOp(){
		$model = model('Base');
		echo $model->delete_table('admin','admin_id in (16,17)');
	}

	public function countOp(){
		$model = model('Base');
		echo $model->count_table('admin','admin_id > 30');
	}
	
	public function testOp(){
		$model = model('Test');
		$model->testlist();
	}
}